<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Staff_settle extends Model
{
    //
	protected $table='staff_settle';
	protected $guard=['id'];
	protected $hidden=[];

	public function lists($store_id){
		return $this->where(['store_id'=>$store_id])->get();
	}


	//店铺应满工时
	public function shoud_hour($store_id){
		return $this->where('store_id',$store_id)->sum('should_hour');
	}
//	店铺实际工时
	public function actual_hour($store_id){
		return $this->where('store_id',$store_id)->sum('actual_hour');
	}

	public function reward_lists($store_id,$store_station_id){
		return $this->where(['store_id'=>$store_id,'store_station_id'=>$store_station_id])->with('StaffInfo')->get();
	}

	public function StaffInfo(){
		return $this->belongsTo('App\Model\Staff','staff_id');
	}

	public function UsersInfo(){
		return $this->belongsTo('App\Model\Users','uid');
	}

}
